from rest_framework import serializers

from goods.models import SKU
from orders.models import OrderInfo, OrderGoods


class SKUSerializer(serializers.ModelSerializer):
    class Meta:
        model = SKU
        fields = "__all__"


class OrderGoodSerializer(serializers.ModelSerializer):
    sku = SKUSerializer(read_only=True)
    class Meta:
        model = OrderGoods
        fields = '__all__'



class OrdersSerializer(serializers.ModelSerializer):
    skus = OrderGoodSerializer(read_only=True, many=True)

    class Meta:
        model = OrderInfo
        fields = '__all__'




